﻿<!-- Phan khai bao bien cuc bo-->
<?php
$v_item_id = $arr_single_creator_af[0][0];
$v_staff_id = $arr_single_creator_af[0][1];
$v_creator_af_name = _get_item_attr_by_id($_SESSION['arr_all_staff'], $v_staff_id, 'name');
$v_creator_af_unit_name = _get_unit_level_one_name($v_staff_id);
$v_count_agency = count ($arr_all_agency); 
$v_count_cate = count ($arr_all_cate); 
$v_count_creator_af_cate = count ($arr_all_creator_af_cate);
$v_count_creator_af_agency = count ($arr_all_creator_af_agency);
?>
<!--bang chua tieu de cua form-->
<table width="100%" cellpadding="0" cellspacing="0">
	<tr class="large_title">
		<td><?php echo CONST_CREATOR_AF_LIST_ADD_LABEL; ?></td>
	</tr>
</table>
<div id="hotkey" onKeyDown="javascript:process_hot_key(true,false,false,true,true);">
<!--bang chua cac text box de nhap du lieu-->
<table align="center" width="100%" class="form_table1" cellpadding="5" cellspacing="0">
	<tr>
		<form action="index.php" method="post" name="f_dsp_single_creator_af">
		<input type="hidden" name="fuseaction" value="DISPLAY_SINGLE_CREATOR_AF" >
		<input type="hidden" name="hdn_agency_id_list" value="">
		<input type="hidden" name="hdn_cate_id_list" value= "">
		<input type="hidden" name="hdn_item_id" value="<?php echo $v_item_id;?>" >
	</tr>
	<tr>
		<td class="normal_label"><?php echo CONST_CREATOR_AF_NAME_LABEL; ?></td>
		<td>
			<input name="txt_creator_af_name" size="20" type="text" readonly class="normal_textbox"  value="<?php echo $v_creator_af_name; ?>" maxlength="100" onKeyDown="change_focus(document.forms(0),this)">
		</td>
	</tr>
	<tr>
		<td class="normal_label"><?php echo CONST_CREATOR_AF_UNIT_NAME_LABEL; ?></td>
		<td>
			<input name="txt_creator_af_unit_name" size = "20" type="text" readonly class="normal_textbox" value="<?php echo $v_creator_af_unit_name; ?>" onKeyDown="change_focus(document.forms(0),this)">
		</td>
	</tr>
	<tr><td colspan="10"><hr color="#66CCFF" size="1"></td></tr>
	<tr><td class="small_title" colspan="10"><?php echo CONST_CREATOR_AF_AGENCY_LABEL;?></td></tr>
	<tr>
		<td colspan="5">
			<table class="list_table2" width="100%" cellpadding="0" cellspacing="0">
				<col width="2%"><col width="98%">
				<tr class="header">
					<td align="center"><?php echo "#"; ?></td>
					<td align="center"><?php echo CONST_AGENCY_LABEL; ?></td>
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td colspan="5">
		<DIV STYLE="overflow: auto; height:80pt; padding-left:5px;margin:0px">
				<table class="list_table2"  width="100%" cellpadding="0" cellspacing="0">
					<col width="2%"><col width="50%"><col width="48%"><?php
						for ($i=0;$i<$v_count_agency;$i++) {
							$v_agency_id = $arr_all_agency[$i][0];
							$v_agency_name = _replace_bad_char($arr_all_agency[$i][2]);
						
							if ($v_current_style_name == "odd_row"){
								$v_current_style_name = "round_row";
							}else{
								$v_current_style_name = "odd_row";
							}
							$v_item_checked = "";
							for ($j=0; $j<$v_count_creator_af_agency; $j++)
								if (($arr_all_creator_af_agency[$j]['0']== $v_item_id) and ($arr_all_creator_af_agency[$j]['1']==$v_agency_id)){
									$v_item_checked = "checked";
									break;
								}	
						?>
						
						<tr value="<?php echo $v_agency_id;?>" checked="<?php echo $v_item_checked;?>" class="<?php echo $v_current_style_name;?>">
							<td ><input type="checkbox" name="chk_agency_id" value="<?php echo $v_agency_id;?>" <?php echo $v_item_checked;?>  onClick="<?php echo $v_item_url_onclick;?>"></td>
							<td colspan="5 "><?php echo $v_agency_name;?></td>
						</tr><?php
						}?>
				</table>
		</DIV>
		</td>
	</tr>
	<tr><td colspan="10"><hr color="#66CCFF" size="1"></td></tr>
	<tr><td class="small_title" colspan="10"><?php echo CONST_CREATOR_AF_CATE_LABEL;?></td></tr>
	<tr>
		<td colspan="5">
			<table class="list_table2" width="100%" cellpadding="0" cellspacing="0">
				<col width="2%"><col width="98%">
				<tr class="header">
					<td align="center"><?php echo "#"; ?></td>
					<td align="center"><?php echo CONST_CATE_LABEL; ?></td>
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td colspan="5">
		<DIV STYLE="overflow: auto; height:80pt; padding-left:5px;margin:0px">
				<table class="list_table2"  width="100%" cellpadding="0" cellspacing="0">
					<col width="2%"><col width="50%"><col width="48%"><?php
						for ($i=0;$i<$v_count_cate;$i++) {
							$v_cate_id = $arr_all_cate[$i][0];
							$v_cate_name = _replace_bad_char($arr_all_cate[$i][2]);
						
						if ($v_current_style_name == "odd_row"){
							$v_current_style_name = "round_row";
						}else{
							$v_current_style_name = "odd_row";
						}
						$v_item_checked = "";
						for ($j=0; $j<$v_count_creator_af_cate; $j++)
								if (($arr_all_creator_af_cate[$j]['0']== $v_item_id) and ($arr_all_creator_af_cate[$j]['1']==$v_cate_id)){
									$v_item_checked = "checked";
									break;
								}	
						?>
						
						<tr value="<?php echo $v_cate_id;?>" checked="<?php echo $v_item_checked;?>" class="<?php echo $v_current_style_name;?>">
							<td ><input type="checkbox" name="chk_cate_id" value="<?php echo $v_cate_id;?>" <?php echo $v_item_checked;?>  onClick="<?php echo $v_item_url_onclick;?>"></td>
							<td colspan="5 "><?php echo $v_cate_name;?></td>
						</tr><?php
						}?>
				</table>
		</DIV>
		</td>
	</tr>
</table>	
<!--bang chua cac button-->
<table width="100%" >
	<tr>
		<td align="center" width="100%" height="40" valign="bottom"><?php
			if ($v_is_granted_update){?>
				<input type="button" name="btn_save" class="normal_button" value="<?php echo _CONST_SAVE_BUTTON; ?>" onClick="btn_save_answerer_qa_onclick(document.forms(0).chk_agency_id,document.forms(0).chk_cate_id,document.forms(0).hdn_agency_id_list,document.forms(0).hdn_cate_id_list,'UPDATE_CREATOR_AF');"><?php
			}?>
				<input type="button" name="btn_back" class="normal_button" value="<?php echo _CONST_BACK_BUTTON;?>" onClick="btn_back_onclick('<?php echo $_GO_BACK?>')" onKeyDown="change_focus(document.forms(0),this)">	
		</td>
	</tr>
</table>		
</div>
</form>

<script language="JavaScript">
	window.dialogHeight = "340pt";
	window.dialogWidth = "420pt";
	window.dialogTop = "80pt";
</script>
